﻿@model ProductOverviewModel

@{
    var parentModel = ViewData["Parent"] as ProductListModel;
}

<datagrid id="deleted-products-grid"
          allow-resize="true"
          allow-row-selection="true"
          allow-edit="false"
          preserve-grid-state="true" preserve-command-state="true"
          allow-column-reordering="true">
    <datasource read="@Url.Action("DeletedProductsList")" />
    <paging position="Bottom" page-index="1" show-size-chooser="true" />
    <sorting allow-unsort="true" allow-multisort="false"></sorting>
    <toolbar>
        <toolbar-group>
            <button datagrid-action="DataGridToolAction.ToggleSearchPanel" type="button" class="btn btn-light btn-icon">
                <i class="fa fa-fw fa-filter"></i>
            </button>
        </toolbar-group>
        <zone name="datagrid_toolbar_alpha"></zone>
        <toolbar-group class="omega"></toolbar-group>
        <zone name="datagrid_toolbar_omega"></zone>
        <toolbar-group>
            <button datagrid-action="DataGridToolAction.ReactToSelection" type="button" class="btn btn-secondary btn-flat grid-command grid-restore-selected">
                <i class="fa fa-repeat"></i>
                <span>@T("Common.Restore")</span>
            </button>
            <button datagrid-action="DataGridToolAction.ReactToSelection" type="button" class="btn btn-danger no-anims btn-flat grid-command grid-delete-selected">
                <i class="far fa-trash-can"></i>
                <span>@T("Common.DeletePermanent")</span>
            </button>
        </toolbar-group>
    </toolbar>
    <search-panel>
        <partial name="Grids/_Grid.Products.Search" model="parentModel" />
    </search-panel>
    <columns>
        @if (parentModel.DisplayProductPictures)
        {
            <column for="PictureThumbnailUrl"
                    title=""
                    width="48px"
                    sortable="false"
                    visible="true"
                    resizable="false"
                    reorderable="false">
                <display-template>
                    <div v-if="item.row.Id > 0" class="hstack justify-content-center position-absolute w-100 h-100 top-0 start-0" style="padding: 8px;">
                        <img :alt="item.row.Id" :src="item.value" style="max-width: 42px; max-height: 32px" />
                    </div>
                </display-template>
            </column>
        }
        <column for="Id" type="string" />
        <column for="Name" width="3fr" hideable="false">
            <display-template>
                <div class="deleted-product-name" :data-key="item.row.Id">
                    @Html.LabeledProductName()
                </div>
            </display-template>
        </column>
        <column for="Sku" />
        <column for="Gtin" visible="false" />
        <column for="ManufacturerPartNumber" visible="false" />
        <column for="NumberOfOrders" halign="center" sortable="false" />
        <column for="Price" halign="flex-end" />
        <column for="ComparePrice" halign="flex-end" visible="false" />
        <column for="SpecialPrice" halign="flex-end" visible="false" />
        <column for="StockQuantity" halign="center" visible="false" />
        <column for="LimitedToStores" visible="!parentModel.IsSingleStoreMode" halign="center" />
        <column for="SubjectToAcl" visible="false" halign="center" />
        <column for="CreatedOn" entity-member="CreatedOnUtc" />
        <column for="UpdatedOn" entity-member="UpdatedOnUtc" />
        <column for="Published" halign="center" visible="false" />
        <column for="AvailableStartDateTimeUtc" visible="false" />
        <column for="AvailableEndDateTimeUtc" visible="false" />
    </columns>
    <row-commands>
        <a datarow-action="DataRowAction.Custom" class="grid-command grid-restore" :data-key="item.row.Id">@T("Common.Restore")</a>
        <a datarow-action="DataRowAction.Custom" class="grid-command grid-delete" :data-key="item.row.Id" v-bind:class="{ disabled: item.row.HasOrders }">@T("Common.DeletePermanent")</a>
    </row-commands>
</datagrid>